package com.sz.mes.dto;

import com.diboot.core.binding.query.BindQuery;
import com.diboot.core.binding.query.Comparison;
import com.sz.mes.entity.PurchaseOrder;
import com.diboot.iam.entity.IamUser;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.util.Date;
import com.diboot.core.util.D;

/**
 * 采购订单 DTO定义
 * @author hem
 * @version 1.0
 * @date 2023-09-05
 * Copyright © szhs
 */
@Getter
@Setter
@Accessors(chain = true)
public class PurchaseOrderDTO extends PurchaseOrder {

    private static final long serialVersionUID = -6179358442525198258L;

    /**
     * 关联字段 系统用户.真实姓名：IamUser.realname
     */
    @BindQuery(comparison = Comparison.EQ, entity = IamUser.class, field = "realname", condition = "this.create_by=id")
    private String createByName;

    /**
     * 业务日期-起始
     */
    @BindQuery(comparison = Comparison.GE, field = "businessDate")
    private Date businessDate;

    /**
     * 业务日期-截止
     */
    @BindQuery(comparison = Comparison.LT, field = "businessDate")
    private Date businessDateEnd;

    /**
     * 交期-起始
     */
    @BindQuery(comparison = Comparison.GE, field = "deliveryDate")
    private Date deliveryDate;

    /**
     * 交期-截止
     */
    @BindQuery(comparison = Comparison.LT, field = "deliveryDate")
    private Date deliveryDateEnd;

    /**
     * 创建时间-起始
     */
    @BindQuery(comparison = Comparison.GE, field = "createTime")
    private Date createTime;

    /**
     * 创建时间-截止
     */
    @BindQuery(comparison = Comparison.LT, field = "createTime")
    private Date createTimeEnd;

    @Override()
    public Date getBusinessDate() {
        return this.businessDate;
    }

    @Override()
    public PurchaseOrder setBusinessDate(Date businessDate) {
        this.businessDate = businessDate;
        return this;
    }

    public Date getBusinessDateEnd() {
        return D.nextDay(businessDate);
    }

    public PurchaseOrder setBusinessDateEnd(Date businessDateEnd) {
        this.businessDateEnd = businessDateEnd;
        return this;
    }

    @Override()
    public Date getDeliveryDate() {
        return this.deliveryDate;
    }

    @Override()
    public PurchaseOrder setDeliveryDate(Date deliveryDate) {
        this.deliveryDate = deliveryDate;
        return this;
    }

    public Date getDeliveryDateEnd() {
        return D.nextDay(deliveryDate);
    }

    public PurchaseOrder setDeliveryDateEnd(Date deliveryDateEnd) {
        this.deliveryDateEnd = deliveryDateEnd;
        return this;
    }

    @Override()
    public Date getCreateTime() {
        return this.createTime;
    }

    @Override()
    public PurchaseOrder setCreateTime(Date createTime) {
        this.createTime = createTime;
        return this;
    }

    public Date getCreateTimeEnd() {
        return D.nextDay(createTime);
    }

    public PurchaseOrder setCreateTimeEnd(Date createTimeEnd) {
        this.createTimeEnd = createTimeEnd;
        return this;
    }
}
